<template>
  <div style="padding: 10px 15px">
    <!-- 查询条件-->
    <div class="filter-container">
      <el-input
        v-model="listQuery.title"
        placeholder="请输入单号"
        style="width: 200px"
        class="filter-item"
        @keyup.enter.native="handleFilter"
      />
      <el-col :span="3" style="fl">
        <el-date-picker
          v-model="form.StDt"
          type="date"
          placeholder="请选择开始日期"
          style="width: 100%"
          format="yyyy-MM-dd"
        />
      </el-col>
      <el-col :span="3">
        <el-date-picker
          v-model="form.EdDt"
          type="date"
          placeholder="请选择结束日期"
          style="width: 100%"
          format="yyyy-MM-dd"
        />
      </el-col>
      <el-button
        class="filter-item seachbttn"
        type="primary"
        icon="el-icon-search"
        @click="handleFilter"
      >查询</el-button>
    </div>
    <div class="filter_fenge" style="border:none;border-top:1px solid #d1ddeb" />
    <div class="filter-container">
      <el-button
        v-if="Jurisdiction('添加')"
        class="filter-item bttnleft"
        type="primary"
        icon="el-icon-edit"
        @click="handleCreate"
      >新增</el-button>
      <el-button
        v-if="Jurisdiction('删除')"
        class="filter-item"
        type="danger"
        icon="el-icon-delete"
        @click="deleteClick()"
      >删除</el-button>
      <el-button
        class="filter-item"
        type="primary"
        icon="el-icon-upload"
        @click="openExportdialog()"
      >导入</el-button>
      <el-button
        class="filter-item"
        type="primary"
        icon="el-icon-download"
      ><a
        href="https://crms.s3.cn-northwest-1.amazonaws.com.cn/ERP%E6%A8%A1%E6%9D%BF.xls"
      >下载ERP订单模板</a></el-button>
    </div>

    <!--查询条件 end-->

    <!--table-->
    <el-table
      v-loading="listLoading"
      :data="AlipayData"
      fit
      highlight-current-row
      style="width: 100%"
      stripe
    >
      <el-table-column
        v-if="this.logincpnid == sy"
        label="企业"
        align="left"
        min-width="150px"
      >
        <template slot-scope="{ row }">
          <span>{{ row.cpnid }}</span>
        </template>
      </el-table-column>
      <el-table-column label="门店" align="right" min-width="150px">
        <template slot-scope="{ row }">
          <span>{{ row.storenumber }}</span>
        </template>
      </el-table-column>

      <el-table-column label="账单日期" align="left" min-width="150px">
        <template slot-scope="{ row }">
          <span>{{ row.statementdate }}</span>
        </template>
      </el-table-column>
      <el-table-column label="交易时间" align="left" min-width="172px">
        <template slot-scope="{ row }">
          <span>{{ row.pydt }}</span>
        </template>
      </el-table-column>

      <el-table-column label="收银机号" align="left" min-width="150px">
        <template slot-scope="{ row }">
          <span>{{ row.cashrootnumber }}</span>
        </template>
      </el-table-column>
      <el-table-column label="收银员号" align="left" min-width="150px">
        <template slot-scope="{ row }">
          <span>{{ row.cashpeoplenumber }}</span>
        </template>
      </el-table-column>
      <el-table-column label="交易小票" align="right" min-width="150px">
        <template slot-scope="{ row }">
          <span>{{ row.devno }}</span>
        </template>
      </el-table-column>
      <el-table-column label="商户订单号" align="left" min-width="300px">
        <template slot-scope="{ row }">
          <span>{{ row.merchantno }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="第三方平台订单号"
        align="left"
        min-width="300px"
      >
        <template slot-scope="{ row }">
          <span>{{ row.othno }}</span>
        </template>
      </el-table-column>
      <el-table-column label="订单金额/元" align="right" min-width="150px">
        <template slot-scope="{ row }">
          <span>{{ row.paymoney }}</span>
        </template>
      </el-table-column>
      <el-table-column label="交易状态" align="left" min-width="80px">
        <template slot-scope="{ row }">
          <span :class="[row.paystate == 0 ? 'green' : 'red']">{{
            row.paystatestr
          }}</span>
        </template>
      </el-table-column>
      <el-table-column label="交易类型" align="left" min-width="80px">
        <template slot-scope="{ row }">
          <span>{{ row.paytypestr }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="第三方平台退款订单号"
        align="left"
        min-width="300px"
      >
        <template slot-scope="{ row }">
          <span>{{ row.othrerundno }}</span>
        </template>
      </el-table-column>
      <el-table-column label="商户退款订单号" align="left" min-width="300px">
        <template slot-scope="{ row }">
          <span>{{ row.merchantrefundno }}</span>
        </template>
      </el-table-column>
      <el-table-column label="备注" align="left" min-width="400px">
        <template slot-scope="{ row }">
          <span>{{ row.remark }}</span>
        </template>
      </el-table-column>

      <!--
    <el-table-column fixed="right" label="操作" width="100">
        <template slot-scope="scope">
          <el-button
            @click="handleClick(scope.row)"
            v-if="Jurisdiction('编辑')"
            type="primary"
            size="mini"
          >编辑</el-button>

          <el-button
            class="filter-item"
            type="danger"
            icon="el-icon-delete"
            v-if="Jurisdiction('删除')"
            @click="deleteClick()"
          >删除</el-button>
        </template>
      </el-table-column>
      -->
    </el-table>
    <!-- <el-descriptions title="ERP信息" direction="vertical" :column="4" border>
    <el-descriptions-item label="企业">kooriookami</el-descriptions-item>
    <el-descriptions-item label="门店">18100000000</el-descriptions-item>
    <el-descriptions-item label="账单日期">苏州市</el-descriptions-item>
    <el-descriptions-item label="交易时间">
     
    </el-descriptions-item>
    <el-descriptions-item label="收银机号">江苏省苏州市</el-descriptions-item>
    <el-descriptions-item label="收银员号">江苏省苏州市</el-descriptions-item>
    <el-descriptions-item label="交易小票">江苏省苏州市</el-descriptions-item>
    <el-descriptions-item label="商户订单号">江苏省苏州市</el-descriptions-item>
    <el-descriptions-item label="订单金额">江苏省苏州市</el-descriptions-item>
    <el-descriptions-item label="交易状态">江苏省苏州市</el-descriptions-item>
    <el-descriptions-item label="交易类型">江苏省苏州市</el-descriptions-item>
    <el-descriptions-item label="第三方退款订单号">江苏省苏州市</el-descriptions-item>
    <el-descriptions-item label="商户退款订单号">江苏省苏州市</el-descriptions-item>
    <el-descriptions-item label="备注">江苏省苏州市</el-descriptions-item>
   </el-descriptions> -->

    <pagination
      v-show="listQuery.total > 0"
      :total="listQuery.total"
      :page.sync="listQuery.page"
      :limit.sync="listQuery.limit"
      @pagination="fetchData(this)"
    />

    <!--table end -->

    <!--弹出层  新增-->
    <el-dialog
      :title="textMap[dialogStatus]"
      :visible.sync="dialogFormVisible"
      width="55%"
    >
      <el-form :model="form" :inline="true" label-position="right">
        <el-form-item label="企业编号">
          <el-input v-model="form.cpnID" />
        </el-form-item>
        <el-form-item label="门店编号">
          <el-input v-model="form.storeNumber" />
        </el-form-item>
        <el-form-item label="收款账户">
          <el-input v-model="form.receivablesAccount" />
        </el-form-item>
        <el-form-item label="账单日期">
          <el-input v-model="form.statementDate" />
        </el-form-item>
        <el-form-item label="交易时间">
          <el-input v-model="form.pyDt" />
        </el-form-item>
        <el-form-item label="交易小时">
          <el-input v-model="form.payHour" />
        </el-form-item>
        <el-form-item label="收银机号">
          <el-input v-model="form.cashRootNumber" />
        </el-form-item>
        <el-form-item label="收银员号">
          <el-input v-model="form.cashPeopleNumber" />
        </el-form-item>
        <el-form-item label="交易描述">
          <el-input v-model="form.payDescribtion" />
        </el-form-item>
        <el-form-item label="交易小票">
          <el-input v-model="form.devNo" />
        </el-form-item>
        <el-form-item label="支付方式">
          <el-input v-model="form.payMode" />
        </el-form-item>
        <el-form-item label="商户订单号">
          <el-input v-model="form.merchantNo" />
        </el-form-item>
        <el-form-item label="第第第三方平台平台订单号">
          <el-input v-model="form.othNo" />
        </el-form-item>
        <el-form-item label="支付渠道">
          <el-input v-model="form.payChannel" />
        </el-form-item>
        <el-form-item label="交易总金额">
          <el-input v-model="form.payMoney" />
        </el-form-item>
        <el-form-item label="交易状态">
          <el-input v-model="form.payState" />
        </el-form-item>
        <el-form-item label="交易类型">
          <el-input v-model="form.payType" />
        </el-form-item>
        <el-form-item label="第第第三方平台平台退款订单号">
          <el-input v-model="form.othRerundNo" />
        </el-form-item>
        <el-form-item label="商户退款订单号">
          <el-input v-model="form.merchantRefundNo" />
        </el-form-item>
        <el-form-item label="退款类型">
          <el-input v-model="form.refundType" />
        </el-form-item>
        <el-form-item label="退款状态">
          <el-input v-model="form.refundState" />
        </el-form-item>
        <el-form-item label="备注">
          <el-input v-model="form.remark" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="saveForm">确 定</el-button>
      </div>
    </el-dialog>

    <!--详情-->
    <el-dialog title="详情" :visible.sync="dialogdetailsVisible" width="55%">
      <el-form
        :model="details_form"
        :inline="true"
        label-position="right"
      />
    </el-dialog>

    <el-dialog title="导出" :visible.sync="exportFormVisible" width="20%">
      <el-form :model="downloadform" :inline="true" label-position="right">
        <el-button
          class="filter-item"
          type="primary"
          icon="el-icon-download"
          :loading="downloadform.nowexportLoading"
          @click="Export(false)"
        >按当前页导出</el-button>
        <!--
            <el-button
          class="filter-item"
          type="primary"
          icon="el-icon-download"
          :loading="downloadform.allexportLoading"
          @click="Export(true)"
        >全部导出</el-button>
        -->
      </el-form>
    </el-dialog>
    <!--导入ERP订单-->
    <el-dialog
      title="导入ERP订单"
      :visible.sync="dialogExportVisible"
      width="55%"
    >
      <div v-loading="exportloading" class="exportotherpaydiv">
        <el-form :model="export_form" :inline="true" label-position="right">
          <el-form-item label="企业号" style="width:80%"
           prop="cpnID"
              :rules="[
                { required: true, message: '企业号不能为空', trigger: 'change' },
              ]"
          >
            <el-select
              v-model="export_form.cpnID"
              filterable
              clearable
              class="filter-item"
              placeholder="请选择企业"
              style="width:80%"
            >
              <el-option
                v-for="item in cpnoptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
                style="width:20%"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="请选择日期" style="width:80%"
             prop="dt"
              :rules="[
                { required: true, message: '日期不能为空', trigger: 'change' },
              ]"
          >
            <el-date-picker
              v-model="export_form.dt"
              style="width:80%"
              type="date"
              placeholder="请选择日期"
              format="yyyy-MM-dd"
            />
          </el-form-item>

          <div style="width: 55%; text-align: left; padding-left: 10%">
            <el-upload
              ref="upload"
              class="upload-otherpay"
              action=""
              :on-preview="handlePreview"
              :on-remove="handleRemove"
              :before-remove="beforeRemove"
              accept=".csv,.xls,.xlsx"
              :before-upload="beforeUpload"
              multiple
              :limit="1"
              :on-exceed="handleExceed"
              :file-list="fileList"
              :auto-upload="false"
            >
              <el-button
                type="primary"
                icon="el-icon-circle-plus-outline"
                plain
              >添加ERP订单文件</el-button>
              <div slot="tip" class="el-upload_tip">
                只能上传.xls/.xlsx/.csv文件
              </div>
            </el-upload>
          </div>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button type="primary" @click="submitUpload()">确 定</el-button>
        </div>
      </div>
    </el-dialog>
    <!--弹出层 end-->
  </div>
</template>

<script>
import Pagination from '@/components/Pagination' // secondary package based on el-pagination
import { AjaxToken, TipConfirm, AjaxUpload } from '@/api/common'
import { SelectAjax } from '@/api/common'
import { Jurisdiction } from '@/api/common'
import sessionStorage from '@/api/Storage'
import 'url-search-params-polyfill'
import commconfig from '@/comm.json'
export default {
  name: 'ERP',
  components: { Pagination },
  data() {
    return {
      logincpnid: '',
      sy: 'system',
      multipleSelection: [],
      formLabelWidth: '120px',
      AlipayData: null,
      cpnoptions: [],
      exportloading: false,
      listQuery: {
        title: '',
        total: 0,
        page: 1,
        limit: 10
      },
      listLoading: true,
      fileList: [],
      dialogFormVisible: false,
      dialogExportVisible: false,
      dialogdetailsVisible: false,
      dialogStatus: '',
      textMap: {
        update: '修改',
        create: '添加'
      },
      exportFormVisible: false,
      downloadform: {
        allexportLoading: false,
        nowexportLoading: false
      },
      form: {
        iD: '',
        cpnID: '',
        storeNumber: '',
        receivablesAccount: '',
        statementDate: '',
        pyDt: '',
        payHour: '',
        cashRootNumber: '',
        cashPeopleNumber: '',
        payDescribtion: '',
        devNo: '',
        payMode: '',
        merchantNo: '',
        othNo: '',
        payChannel: '',
        payMoney: '',
        payState: '',
        payType: '',
        othRerundNo: '',
        merchantRefundNo: '',
        refundType: '',
        refundState: '',
        remark: '',
        StDt: '',
        EdDt: ''
      },
      details_form: {
        iD: '',
        cpnID: '',
        storeNumber: '',
        receivablesAccount: '',
        statementDate: '',
        pyDt: '',
        payHour: '',
        cashRootNumber: '',
        cashPeopleNumber: '',
        payDescribtion: '',
        devNo: '',
        payMode: '',
        merchantNo: '',
        othNo: '',
        payChannel: '',
        payMoney: '',
        payState: '',
        payType: '',
        othRerundNo: '',
        merchantRefundNo: '',
        refundType: '',
        refundState: '',
        remark: ''
      },
      export_form: {
        cpnID: '',
        dt: ''
      }
    }
  },
  // 初始化
  created() {
    var userinfo = JSON.parse(sessionStorage.getItem('userinfo'))
    this.logincpnid = userinfo.cpnId
    this.fetchData()
  },
  mounted() {
    backstage.GeCpntListItems(this)
  },
  methods: {
    submitUpload() {
      var that = this
      if(this.export_form.cpnID==""){
         this.$message({
            type: 'error',
            duration: 1000,
            message: '请选择企业!'
          })
          return
      }
      if(this.export_form.dt==""){
           this.$message({
            type: 'error',
            duration: 1000,
            message: '请选择日期!'
          })
          return   
      }
      setTimeout(function() {
        if (that.$refs.upload.$children[0].fileList.length == 1) {
          that.$refs.upload.submit()
        } else {
          that.$message({
            type: 'error',
            showClose: true,
            duration: 3000,
            message: '请选择文件!'
          })
        }
      }, 100)
    },
    beforeUpload(file) {
      var that = this
      that.$refs.upload.clearFiles()
      // 文件类型
      var fileName = file.name.substring(file.name.lastIndexOf('.') + 1)
      if (fileName != 'xls' && fileName != 'xlsx' && fileName != 'csv') {
        that.$message({
          type: 'error',
          showClose: true,
          duration: 3000,
          message: '文件类型不是.xls/.xlsx/.csv文件!'
        })
        return false
      }
      if (this.export_form.cpnID == '') {
        that.$message({
          type: 'error',
          showClose: true,
          duration: 3000,
          message: '请选择企业'
        })
        return false
      }
      if (this.export_form.dt == '') {
        that.$message({
          type: 'error',
          showClose: true,
          duration: 3000,
          message: '请选择日期'
        })
        return false
      }
      const params = new FormData()
      params.append('file', file)
      params.append('cpnID', this.export_form.cpnID)
      params.append('dt', new Date(this.export_form.dt).toLocaleDateString())
      params.append('_t1', new Date())
      that.exportloading = true
      backstage.beforeUpload(that, params)
    },
    openExportdialog() {
      this.dialogExportVisible = true
      var that = this
      setTimeout(function() {
        that.$refs.upload.clearFiles()
      }, 100)
    },
    handleRemove(file, fileList) {
      console.log(file, fileList)
    },
    handlePreview(file) {
      console.log(file)
    },
    handleExceed(files, fileList) {},
    beforeRemove(file, fileList) {
      // return this.$confirm(`确定移除 ${file.name}？`);
    },
    Export(Export) {
      if (Export) {
        this.downloadform.allexportLoading = true
      } else {
        this.downloadform.nowexportLoading = true
      }
      backstage.AlipayLstExport(this, Export)
    },
    // 权限
    Jurisdiction(moduleActionName) {
      return Jurisdiction(moduleActionName, this)
    },
    // 多选
    handleSelectionChange(val) {
      this.multipleSelection = val
    },
    // 多选赋值
    toggleSelection(rows) {
      if (rows) {
        rows.forEach((row) => {
          this.$refs.multipleTable.toggleRowSelection(row)
        })
      } else {
        this.$refs.multipleTable.clearSelection()
      }
    },
    // 搜索
    handleFilter() {
      this.listQuery.page = 1
      this.fetchData()
    },
    // 新增
    handleCreate() {
      this.dialogStatus = 'create'
      this.dialogFormVisible = true
      this.form = {
        iD: '',
        cpnID: '',
        storeNumber: '',
        receivablesAccount: '',
        statementDate: '',
        pyDt: '',
        payHour: '',
        cashRootNumber: '',
        cashPeopleNumber: '',
        payDescribtion: '',
        devNo: '',
        payMode: '',
        merchantNo: '',
        othNo: '',
        payChannel: '',
        payMoney: '',
        payState: '',
        payType: '',
        othRerundNo: '',
        merchantRefundNo: '',
        refundType: '',
        refundState: '',
        remark: ''
      }
    },
    // 编辑
    handleClick(row) {
      this.form.iD = row.iD
      this.form.cpnID = row.cpnID
      this.form.storeNumber = row.storeNumber
      this.form.receivablesAccount = row.receivablesAccount
      this.form.statementDate = row.statementDate
      this.form.pyDt = row.pyDt
      this.form.payHour = row.payHour
      this.form.cashRootNumber = row.cashRootNumber
      this.form.cashPeopleNumber = row.cashPeopleNumber
      this.form.payDescribtion = row.payDescribtion
      this.form.devNo = row.devNo
      this.form.payMode = row.payMode
      this.form.merchantNo = row.merchantNo
      this.form.othNo = row.othNo
      this.form.payChannel = row.payChannel
      this.form.payMoney = row.payMoney
      this.form.payState = row.payState
      this.form.payType = row.payType
      this.form.othRerundNo = row.othRerundNo
      this.form.merchantRefundNo = row.merchantRefundNo
      this.form.refundType = row.refundType
      this.form.refundState = row.refundState
      this.form.remark = row.remark
      this.dialogStatus = 'edit'
      this.dialogFormVisible = true
    },
    // 保存
    saveForm() {
      var arr = this.multipleSelection
      var params = new URLSearchParams()
      params.append('CpnID', this.form.cpnID)
      params.append('StoreNumber', this.form.storeNumber)
      params.append('ReceivablesAccount', this.form.receivablesAccount)
      params.append('StatementDate', this.form.statementDate)
      params.append('PyDt', this.form.pyDt)
      params.append('PayHour', this.form.payHour)
      params.append('CashRootNumber', this.form.cashRootNumber)
      params.append('CashPeopleNumber', this.form.cashPeopleNumber)
      params.append('PayDescribtion', this.form.payDescribtion)
      params.append('DevNo', this.form.devNo)
      params.append('PayMode', this.form.payMode)
      params.append('MerchantNo', this.form.merchantNo)
      params.append('OthNo', this.form.othNo)
      params.append('PayChannel', this.form.payChannel)
      params.append('PayMoney', this.form.payMoney)
      params.append('PayState', this.form.payState)
      params.append('PayType', this.form.payType)
      params.append('OthRerundNo', this.form.othRerundNo)
      params.append('MerchantRefundNo', this.form.merchantRefundNo)
      params.append('RefundType', this.form.refundType)
      params.append('RefundState', this.form.refundState)
      params.append('remark', this.form.remark)
      backstage.SaveAlipay(this, params)
    },
    // 删除
    deleteClick(row) {
      var multis = []
      var params = new URLSearchParams()
      if (row == undefined || row == '') {
        var arr = this.multipleSelection
        if (arr == undefined || arr.length <= 0) {
          this.$message({
            showClose: true,
            message: '请至少选中一行',
            type: 'error'
          })
          this.listLoading = false
          return
        } else {
          for (var i = 0; i < arr.length; i++) {
            multis.push(arr[i].id)
          }
          params.append('delds', JSON.stringify(multis))
        }
      } else {
        multis.push(row.id)
        params.append('delds', JSON.stringify(multis))
      }
      this.$confirm('确认删除吗？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'error'
      })
        .then((a) => {
          this.listLoading = true
          backstage.DelAlipay(this, params)
        })
        .catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          })
          this.listLoading = false
        })
    },
    // 查询
    fetchData() {
      this.listLoading = true
      var params = new URLSearchParams()
      params.append(
        'Parms',
        '{"page":' +
          this.listQuery.page +
          ',"rows":' +
          this.listQuery.limit +
          '}'
      )
      var user = JSON.parse(sessionStorage.getItem('userinfo'))
      params.append(
        'StDt',
        this.form.StDt == '' ? '' : this.form.StDt.toLocaleDateString()
      )
      params.append(
        'EdDt',
        this.form.EdDt == '' ? '' : this.form.EdDt.toLocaleDateString()
      )
      params.append('PayID', this.listQuery.title)
      params.append('CpnID', this.logincpnid)
      backstage.GetAlipayLst(this, params)
    }
  }
}
// 后台事件
var backstage = {
  AlipayLstExport: function(thisobj, Export) {
    var StDt =
      thisobj.form.StDt == '' ? '' : thisobj.form.StDt.toLocaleDateString()
    var EdDt =
      thisobj.form.EdDt == '' ? '' : thisobj.form.EdDt.toLocaleDateString()
    var PayID = thisobj.listQuery.title
    var CpnID =
      thisobj.logincpnid == 'sysytem' ? this.form.cpnID : thisobj.logincpnid

    var url =
      commconfig.baseapi +
      'AlipayLstExport?Parms=' +
      '{"page": "' +
      thisobj.listQuery.page +
      '","rows": "' +
      thisobj.listQuery.limit +
      '"}' +
      '&Export=' +
      Export +
      '&StDt=' +
      StDt +
      '&EdDt=' +
      EdDt +
      '&PayID=' +
      PayID +
      '&CpnID=' +
      CpnID
    if (Export) {
      thisobj.downloadform.allexportLoading = false
    } else {
      thisobj.downloadform.nowexportLoading = false
    }
    window.location.href = url
  },
  // 获取Alipay集合
  GetAlipayLst: function(thisobj, params) {
    AjaxToken(
      thisobj,
      'GetAlipayLst',
      params,
      'post',
      function(res) {
        thisobj.listLoading = false
        var body = res.data.data
        thisobj.AlipayData = body.rows
        thisobj.listQuery.page = body.page
        thisobj.listQuery.total = body.records
      },
      function(err) {}
    )
  },
  SaveAlipay: function(thisobj, params) {
    AjaxToken(
      thisobj,
      'SaveAlipay',
      params,
      'post',
      function(res) {
        var body = res.data
        if (body.success) {
          thisobj.$message({
            showClose: true,
            message: body.message,
            type: 'success',
            duration: 2000
          })
          thisobj.fetchData()
          thisobj.dialogFormVisible = false
        } else {
          thisobj.$message({
            showClose: true,
            message: body.message,
            type: 'error'
          })
        }
      },
      function(err) {}
    )
  },
  DelAlipay: function(thisobj, params) {
    AjaxToken(
      thisobj,
      'DelAlipay',
      params,
      'post',
      function(res) {
        thisobj.listLoading = false
        var body = res.data
        if (body.success) {
          thisobj.$message({
            showClose: true,
            message: body.message,
            type: 'success',
            duration: 2000
          })
          thisobj.fetchData()
          thisobj.dialogFormVisible = false
        } else {
          thisobj.$message({
            showClose: true,
            message: body.message,
            type: 'error'
          })
        }
      },
      function(err) {}
    )
  },
  GeCpntListItems: function(thisobj) {
    SelectAjax(
      'GeCpntListItems?val=' + thisobj.cpnid + '',
      function(response) {
        var body = response.data
        thisobj.cpnoptions = []
        body.data.forEach((element) => {
          thisobj.cpnoptions.push({
            value: element.value,
            label: element.text
          })
        })
      },
      function(error) {}
    )
  },
  beforeUpload: function(that, params) {
    AjaxUpload(
      that,
      'ERPUploadFile',
      params,
      'post',
      function(res) {
        that.exportloading = false
        that.$message({
          type: res.data.success ? 'success' : 'error',
          showClose: true,
          message: res.data.message
        })
        if (res.data.success) {
          that.dialogExportVisible = false
        }
      },
      function(error) {
        that.exportloading = false
        that.$message({
          type: 'error',
          showClose: true,
          message: '请求失败! error:' + error
        })
      }
    )
  }
}
</script>
<style>
.exportotherpaydiv .el-form-item--medium .el-form-item__label {
  text-align: right;
  font-weight: 400;
  width: 100px;
}
.exportotherpaydiv .dialog-footer {
  text-align: right;
}
.el-select-dropdown__item{
  width: 100% !important;
}
</style>
